package com.tantou.leetcode.easy;

import java.util.Arrays;

/**
 * @author jiangweiyang
 * @created 2020/4/30 13:49
 **/
public class ContainsDuplicate {

    /**
     * https://leetcode-cn.com/problems/contains-duplicate/submissions/
     * @param args
     */
    public static void main(String[] args) {
        int[] nums = new int[]{3,1,3,4,2};
        System.out.println(containsDuplicate(nums));
    }

    public static boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        for(int i=0;i<nums.length-1;i++){
            if( nums[i]==nums[i+1]){
                return true;
            }
        }
        return false;
    }
}
